This tutorial will teach you how to use the CGIEmail script that is pre-installed with your hosting account.
What is CGIEmail?
CGIEmail is a form mailing script, similar in function to Matt Wright's formmail.pl, but it uses a text based email template instead of just sending an email with a list of form variables.
Where is CGIEmail located?
http://www.yourdomain.com/cgi-sys/cgiemail
--------------------------------------------------------------------------------
This tutorial is broken down to 5 steps:
1.) Creating the HTML Form
2.) Creating the Email Template
3.) Testing your form.
4.) Extra features
1.) Creating the HTML Form
Create a simple html form in your favourite html editor. Something similar to this one:
HTML Source:
<FORM action="/cgi-sys/cgiemail/foobar/myform.txt" METHOD="post">
|
2.) Creating the Email Template
The Email template is just a regular plan text file. You can name it pretty much whatever you want, except "email.txt" . The first couple of lines must include the following information:
To use the data submitted in the form, place the form field name inside []. We will name our template myform.txt for the purpose of this tutorial. So our email template will look like this:
Now save the myform.txt and form.html.
3.) Testing our Form
Now that we have our html page, and our email template, we just need to upload it to our website and test it. When you submit a form, you should see a page that shows the email that will be sent to the recipient.
4.) Extra CGIEmail Features
Here are some extra features that cgiemail supports:
Required Form Fields
Prepend required- to the name of the form field in both your html form, and the email template and it will force the user to enter a value for that field. Your code should look something like this:
form.html
<INPUT TYPE="text" NAME="required-firstname">
|
myform.txt
Hi, my name is [required-firstname]
|
Submission Success Page
You can have the user directed to a html page of your choice after they submit the form, instead of being taken to a page showing the email. To do this, put the following code in your html form page.
<INPUT TYPE="hidden" NAME="success" VALUE="http://www.domain.com/somepage.html">
|
|